<?php
require_once ("ScaleImage.php");

class ScaleImageThread {
    function ScaleImageThread(){
    }

    function run($pathSource, $pathSave, $maxWidth = 185, $maxHeight = 200){
        $img = new ScaleImage();

        /*
         * sets the max width and max height of thumb
         */
        $img->pSetSize($maxWidth, $maxHeight);

        /*
         * set quality of the output image if jpeg
         */
        $img->pSetQuality(100);

        /*
         * all of them will be overwrited by this function if more than 1 parameter is call
         * pCreate(image path, max width, max height, quality)
         * max width, max height, quality are optional
         * if no image present will be drawn one
         */
        $img->pCreate($pathSource);

        /*
         * this class rotate the image
         * the second parameter is optional. specifies the direction of rotation
         * the default is CW. you can set it to CCW either
         * ot you can use 1 instead of CW and 2 instead of CCW
         * the third parameter is optional. specifies the color of the uncovered zone after the rotation.
         * //$img->pRotate(5);

         * save the image
         * if the directory is not present will be created
         */
        $img->pSave($pathSave);
    }
}